package com.study.mysql.readwriteseparation1.controller;

import com.study.mysql.readwriteseparation1.entity.BusinessOrder;
import com.study.mysql.readwriteseparation1.service.IBusinessOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/business/order")
public class BusinessOrderController {

    @Autowired
    private IBusinessOrderService iBusinessOrderService;

    @GetMapping("/getMasterById")
    public BusinessOrder queryMasterOrder() {
        BusinessOrder businessOrder = iBusinessOrderService.queryMasterOrder("123");
        return businessOrder;
    }

    @GetMapping("/getSlaveById")
    public BusinessOrder querySlaveOrder() {
        BusinessOrder businessOrder = iBusinessOrderService.querySlaveOrder("123");
        return businessOrder;
    }

    @GetMapping("/add")
    public BusinessOrder addOrder() {
        BusinessOrder businessOrder = iBusinessOrderService.addOrder();
        return businessOrder;
    }
}
